package yu.zhu.todo.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import yu.zhu.todo.entity.Result;
import yu.zhu.todo.entity.StatusCode;

/**
 * @Author yuzhu
 * @Date 2020/11/11 15:52
 */
@ControllerAdvice
public class BaseExceptionHandler {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handle(Exception e){
        e.printStackTrace();
        return  new Result(false, StatusCode.ERROR, e.getMessage());
    }
}
